package com.sntk.organauthomanager.infrastructure.db.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName: UserRoleEntity
 * @author: wgchao
 * @createTime: 2020/7/21 6:02 PM
 * @Description: TODO
 */
@Table(name = "sys_organ_user_role_info", uniqueConstraints = @UniqueConstraint(columnNames = {"uname", "institution_number", "role_code"}))
@org.hibernate.annotations.Table(appliesTo = "sys_organ_user_role_info", comment = "用户角色信息")
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class UserRoleEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "uname", length = 20, columnDefinition="varchar(20) COMMENT '账户名'", nullable = false)
    private String uname;

    //机构编号
    @Column(name = "institution_number", length = 100, columnDefinition="varchar(100) COMMENT '所属机构编号'", nullable = false)
    private String institutionNumber;

    //角色码
    @Column(name = "role_code", length = 20, columnDefinition="varchar(20) COMMENT '角色码'", nullable = false)
    private String roleCode;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "creator", length = 50)
    private String creator;
}
